﻿using System;
using BlueDot.Mobile.Core;

namespace SplashScreen.Views
{
    public partial class MainView : ViewBase
    {
        #region Fields

        /// <summary>
        /// Receives a notification when the view is shown.
        /// </summary>
        private const string MainViewShown = WellKnownActions.ViewShown + "/MainView";

        #endregion

        #region Constructors

        public MainView()
        {
            InitializeComponent();
        }

        [DependencyConstructor]
        public MainView(IMobileApplication application)
            : base(application)
        {
            InitializeComponent();
        }

        #endregion

        #region public

        [Receiver(MainViewShown)]
        public void MainViewShownAction(object sender, EventArgs e)
        {
            ((Shell) Application.Shell).Menu = mainMenu;
            Splash.CloseSplashScreen();
        }

        public bool OnExit()
        {
            Application.ExitRuntime();
            return true;
        }

        #endregion
    }
}